package com.liangzhong.model.shop
{
	import com.common.utils.Debug;
	import com.common.utils.TimeFrameUtil;
	import com.liangzhong.constants.ResourceConst;
	import com.liangzhong.events.ShopEvent;
	import com.liangzhong.manager.ResourceManager;
	import com.liangzhong.model.AppData;
	import com.liangzhong.model.shop.vo.ShopVo;
	import com.liangzhong.model.type.GoodsType;
	
	import flash.display.BitmapData;
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import flash.utils.Dictionary;
	
	import lz.controls.Alert;

	/**
	 * 商城数据管理器 
	 * @author lake
	 * 
	 */	
	public class ShopDataManager extends EventDispatcher
	{
		/**
		 *商城列表数据 
		 */
		public var shopList:Array;
		/**
		 *星期 
		 */
		public var week:int = -1;
		public function ShopDataManager()
		{
			
		}
		/**
		 *解析商城列表数据 
		 * 
		 */
		public function analsisList($arr:Array):void
		{
			if(shopList == null)shopList = [];
			shopList.splice(0,shopList.length);
			var len:int = $arr.length;
			var vo:ShopVo;
			for(var i:int = 0;i < len;i++)
			{
				vo = new ShopVo();
				vo.analysis($arr[i]);
				if(vo.ntype == GoodsType.PLAYERCARD)
					shopList.unshift(vo);
				else
					shopList.push(vo);
			}
//			shopList = shopList.concat(shopList);
//			shopList.sortOn("id");
			
			shopList.sortOn(["ntype","cost"],[Array.DESCENDING|Array.DESCENDING]);
			this.dispatchEvent(new ShopEvent(ShopEvent.SHOP_GOODSLIST));
			week = AppData.getInstance().clientDate.day;
		}
	}
}